package mkis.service.root.controller;

import java.util.Locale;

import javax.annotation.Resource;

import mkis.service.root.data.model.SampleJson;
import mkis.service.root.service.TestService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController {
	
	private Logger logger=LoggerFactory.getLogger(this.getClass());
	
	@Resource(name="testService")
	private TestService testService;
	/**
	 * Simply selects the home view to render by returning its name.
	 * @throws Throwable 
	 */
	@RequestMapping(value = "/test.do", method = RequestMethod.GET)
	public String home(Locale locale, Model model) throws Exception {
		
		logger.debug("{}",testService.getList());
		
		//testService.multisaveInsert("등록1");
		
		return "home";
	}
	
	@RequestMapping(value= "/sampleJson.do", method=RequestMethod.POST)
	public @ResponseBody SampleJson sampleJSON()  {
	    SampleJson sample=new SampleJson();
	    sample.setId("아이디");
	    sample.setName("이름");
		   
	    sample.setBody("본문");
	    sample.setFooter("꼬리표");
	    return sample;
	}
}
